package com.cyys.modules.wx.model.user;

import com.baomidou.mybatisplus.annotation.TableName;
import com.cyys.common.utils.StringUtil;
import com.cyys.modules.core.model.CoreBean;
import com.cyys.modules.core.sysParam.ParamBasicUtil;
import com.cyys.modules.core.sysParam.ParamConstants;
import com.cyys.modules.wx.model.user.response.WxUserinfoResp;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

/**
* @description 
* @author LC
* @date 2020-10-22
*/
@Data
@TableName("wx_userinfo")
public class WxUserinfo extends CoreBean {

	private String openId; //微信编号

	private String phone; //手机号
	@JsonIgnore
	private String cipher; //登录密码

	@JsonIgnore
	private String disable; //是否禁用
	@JsonIgnore
	public String getDisableName() {
		if(StringUtil.isNotEmpty(disable))
			return ParamBasicUtil.getParamBasicTypeMap().get(ParamConstants.DISABLE).get(disable);
		return "";
	}
	private String idCard; //身份证号
	private String nickName; //微信昵称
	private String avatarUrl; //微信头像
	private String gender; //性别
	@JsonIgnore
	public String getGenderName() {
		if(StringUtil.isNotEmpty(gender))
			return ParamBasicUtil.getParamBasicTypeMap().get(ParamConstants.SEX).get(gender);
		return "";
	}

	private String province; //省
	private String city; //市
	private String country; //县

	@JsonIgnore
	public WxUserinfoResp toResponseEntity() {
		WxUserinfoResp newObj= new WxUserinfoResp();
		newObj.setId(this.getId());
		newObj.setPhone(this.getPhone());
		newObj.setNickName(this.getNickName());
		newObj.setGenderName(this.getGenderName());
		newObj.setAvatarUrl(this.getAvatarUrl());
		newObj.setProvince(this.getProvince());
		newObj.setCity(this.getCity());
		newObj.setCountry(this.getCountry());
		return newObj;
	}
}
